<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <cpn>
            <button>插槽</button>
        </cpn>
        <cpn>
            <span>插槽</span>
        </cpn>
        <cpn>
            <h1>插槽</h1>
        </cpn>
        <cpn></cpn>
        <cpn></cpn>
        <cpn></cpn>
    </div>
</body>
<template id="cpn">
    <div>
        <h1>我是子组件标题</h1>
        <!-- 没有默认值 -->
        <!-- <slot></slot> -->
        <!-- 有默认值 -->
        <slot><button>默认值按钮</button></slot>
        <hr>
    </div>
</template>
<script src="../js/http_cdn.bootcdn.net_ajax_libs_vue_2.6.6_vue.js"></script>
<script>
    new Vue({
        el: "#app",
        components: {
            cpn: {
                template: "#cpn"
            }
        }
    })
</script>

</html>
